<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="com.crm.util.RequestEx"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>  
    <title>CRM客户管理</title>
    <link rel="icon" mce_href="<%=path%>/images/title_logo.ico" href="<%=path%>/images/title_logo.ico" type="image/x-ico"/>
    <link rel="shortcut icon" mce_href="<%=path%>/images/title_logo.ico" href="<%=path%>/images/title_logo.ico" type="image/x-ico"/>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>	
	<link rel="stylesheet" type="text/css" href="<%=path%>/js/easyui1.3.2/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="<%=path%>/js/easyui1.3.2/themes/icon.css">	
	<script type="text/javascript" src="<%=path%>/js/easyui1.3.2/jquery-1.8.0.min.js"></script>
	<script type="text/javascript" src="<%=path%>/js/easyui1.3.2/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="<%=path%>/js/easyui1.3.2/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="<%=path%>/js/My97DatePicker/WdatePicker.js"></script>
	<style type="text/css">
		body,td,th,div{
 			font-size:12px;
		}
	</style>
  </head>
  
  <body style="margin:0;padding:0" class="">
    <script type="text/javascript">

	var datagrid;
	var url = "<%=path%>/con.do";

	//新增数据
	function doSave(isContinue){		
		$("#conSaveOrUpdateForm").form('submit', { 
	        url: url + '?method=saveOrUpdatecon',	        
			success:function(data){
				if('ok' == data){
					$('#conSaveOrUpdate').dialog('close');				
					datagrid.datagrid('reload');
				}else{
					$.messager.alert('提示', data, 'info');
				}
			},
			error : function() {
			
			}
		});
	}

	//修改数据
	function doUpdate(){
		var node = datagrid.datagrid('getSelected');
		$('#conSaveOrUpdate').dialog({  
			title: '修改',  
			width: 260,
			height: 130,
			closed: false,  
			cache: false,   
			modal: true,
			onClose:function(){$('#conSaveOrUpdateForm').form('clear');}
		});
		$('#conSaveOrUpdateForm').form('load',{
			conid: node.conid,
			CValue: node.CValue
		});	
	}
	
	//定义datagrid列模型
	var columns = [[
		{field:'oper',title:'操作',width:50,formatter:formatOper},
		{field:'conid',title:'配置主键',width:20,hidden:true},
		{field:'CKey',title:'配置名',width:60},
		{field:'CValue',title:'配置值',width:140},
		{field:'remark',title:'备注',width:260}
	]];

	//入口
	$(function(){
		datagrid = $('#datagrid');
		$(datagrid).datagrid({
			url:url+'?method=getConList', 
			columns:columns,
			title:'', 
			loadMsg:'正在处理...',
			iconCls:'', 
			nowrap: true, 
			rownumbers: true,
			autoRowHeight: false,
			autoRowWidth: true,             
			animate:true, 
			singleSelect: true,
			collapsible: true, 
			fitColumns: true,//自动充满列
			fit:true,//自动充满浏览器区域
			idField:'id', 
			showFooter: false,
			striped:true,//斑马线
			pagination:false,
			onDblClickRow:function(rowIndex, rowData){
				doUpdate();
			}
		}); 
	}); 

	//格式化操作
	function formatOper(value, row){
		var updateOper = "<a href='javascript:doUpdate();'>修改</a>";
		return updateOper;
	}
	</script>
	<!-- 表格面板 -->
	<table id="datagrid"></table>
	
	<!-- 新增或编辑面板 -->
	<div id="conSaveOrUpdate" class="easyui-dialog" closed="true" data-options="buttons:'#buttonsSaveOrUpdate'" style="padding-top:10px;padding-right:10px;overflow:hidden">
	    <form id="conSaveOrUpdateForm" name="conSaveOrUpdateForm" action="" method="post">
	    	<input type="hidden" id="conid" name="conid" value="">
	    	<table border="0" bordercolor="red" width="100%">
				<tr height="30px">
	    			<td align="right">配置值</td>
	    			<td><input style="width:180px" class="easyui-validatebox" type="text" id="CValue" name=CValue data-options="validType:['length[0,180]']"/></td>
	    		</tr>	    		
	    	</table>
	    </form>
	</div>
	<div id="buttonsSaveOrUpdate" style="display:none">
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:doSave()">保存</a>
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:$('#conSaveOrUpdate').dialog('close');">关闭</a>
	</div>
  </body>
</html>
